<#-- copied from spring.bind -->
<#macro bind path>
    <#if htmlEscape?exists>
        <#assign status = springMacroRequestContext.getBindStatus(path, htmlEscape)>
    <#else>
        <#assign status = springMacroRequestContext.getBindStatus(path)>
    </#if>
    <#-- assign a temporary value, forcing a string representation for any
    kind of variable.  This temp value is only used in this macro lib -->
    <#if status.value?exists && status.value?is_boolean>
        <#assign stringStatusValue=status.value?string>
    <#else>
        <#assign stringStatusValue=status.value?default("")>
    </#if>
</#macro>

<#macro singleRadioButton path trueLabel="Yes" falseLabel="No" separator="<br/>" attributes="">
	<@bind path />
	<input type="radio" name="${status.expression}" value="true" 
		<#if status.value>checked</#if> ${attributes}
	/>${trueLabel}${separator}
	<input type="radio" name="${status.expression}" value="false" 
		<#if !status.value>checked</#if> ${attributes}
	/>${falseLabel}
</#macro>

<#-- NOTE: The numeric value 0 (zero) is shown as a space -->
<#macro enumDropDown path options>
	<@bind path />
    <select id="${status.expression}" name="${status.expression}">
	    <#list options as option>
    		<option value="${option}"<@checkSelected option/>><#if option?is_number && option==0> <#else>${option}</#if></option>
        </#list>
	</select>		
</#macro>

<#-- Copied from spring.ftl but changed slightly to work correctly with numbers -->
<#macro checkSelected value>
    <#if status.value?? && status.value?is_number && status.value == value?number>selected="selected"</#if>
    <#if status.value?? && status.value?is_string && status.value == value?string>selected="selected"</#if>
</#macro>

<#-- Provides a consistent format for date objects used for navigation -->
<#macro navDateFormat date>${date?string("MM/dd/yyyy")}</#macro>

<#-- Loops thru and displays all field and global errors bound to an object -->
<#macro listErrors path cssClass="errors" separator="<br />">
	<@bind path />
	<#if (status.errors.fieldErrors?size > 0 || status.errors.globalErrors?size > 0 ) >
	    <div class="${cssClass}">
	        <#list status.errors.fieldErrors as error>
	            <@spring.message error />${separator}
	            <#--${error}<br /> -->
	        </#list>
	        <#list status.errors.globalErrors as error>
	            <@spring.message error />${separator}
	        </#list>
	    </div>
	    <br />
	</#if>

</#macro>

